#include <stdio.h>


int mysort(int *arr,int left,int right)
{
	if(left>=right)
	{
		return -1;
	}
	int flag=arr[left];
	int low=left;
	int high=right;
	while(low!=high)
	{
		while(low!=high&&flag<=arr[high])
			high--;
		if(low!=high)
		{
			arr[low]=arr[high];
			low++;
		}
		while(low!=high&&flag>=arr[low])
			low++;
		if(low!=high)
		{
			arr[high]=arr[low];
			high--;
		}
	}
	arr[low]=flag;
	mysort(arr,left,low-1);
	mysort(arr,low+1,right);
	
	return 0;
}

int view(int *arr)
{
	for(int i=0;i<9;i++)
	{
		printf("%d ",arr[i]);
	}
	puts(" ");
}

int main(int argc, const char *argv[])
{
	int arr[9]={11,99,77,33,66,22,55,44,88};
	mysort(arr,0,8);

	view(arr);
	return 0;
}
